{"ast":null,"code":"var _jsxFileName = \"/Users/iliyagladkov/to-do-react/src/components/UI/forms/ToDoForm.jsx\",\n  _s = $RefreshSig$();\nimport React, { useState } from 'react';\nimport MyInput from '../input/MyInput';\nimport MyButtonAdd from '../MyButton/MyButtonAdd/MyButtonAdd';\nimport cl from './ToDoForm.module.css';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nexport default function ToDoForm(_ref) {\n  _s();\n  let {\n    create\n  } = _ref;\n  const [toDoItem, setToDoItem] = useState({\n    title: '',\n    body: ''\n  });\n  function addNewToDo(e) {\n    e.preventDefault();\n    const newToDo = {\n      ...toDoItem,\n      id: Date.now()\n    };\n    create(newToDo);\n    setToDoItem({\n      title: '',\n      body: ''\n    });\n    localStorage.setItem('tasks', JSON.stringify(toDoItem));\n  }\n  return /*#__PURE__*/_jsxDEV(\"form\", {\n    className: cl.myForm,\n    children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n      className: cl.headerAdd,\n      children: \"New to-do\"\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 22,\n      columnNumber: 13\n    }, this), /*#__PURE__*/_jsxDEV(MyInput, {\n      value: toDoItem.title,\n      onChange: e => setToDoItem({\n        ...toDoItem,\n        title: e.target.value\n      }),\n      type: \"text\",\n      placeholder: \"This is title...\"\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 23,\n      columnNumber: 13\n    }, this), /*#__PURE__*/_jsxDEV(MyInput, {\n      value: toDoItem.body,\n      onChange: e => setToDoItem({\n        ...toDoItem,\n        body: e.target.value\n      }),\n      type: \"text\",\n      placeholder: \"This is description...\"\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 29,\n      columnNumber: 13\n    }, this), /*#__PURE__*/_jsxDEV(MyButtonAdd, {\n      onClick: addNewToDo\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 35,\n      columnNumber: 13\n    }, this)]\n  }, void 0, true, {\n    fileName: _jsxFileName,\n    lineNumber: 21,\n    columnNumber: 9\n  }, this);\n}\n_s(ToDoForm, \"w5tKIkICB9taBMm3TYdcAonTtvU=\");\n_c = ToDoForm;\nvar _c;\n$RefreshReg$(_c, \"ToDoForm\");","map":{"version":3,"names":["React","useState","MyInput","MyButtonAdd","cl","ToDoForm","create","toDoItem","setToDoItem","title","body","addNewToDo","e","preventDefault","newToDo","id","Date","now","localStorage","setItem","JSON","stringify","myForm","headerAdd","target","value"],"sources":["/Users/iliyagladkov/to-do-react/src/components/UI/forms/ToDoForm.jsx"],"sourcesContent":["import React, { useState } from 'react'\nimport MyInput from '../input/MyInput'\nimport MyButtonAdd from '../MyButton/MyButtonAdd/MyButtonAdd'\nimport cl from './ToDoForm.module.css'\n\nexport default function ToDoForm({create}) {\n    const [toDoItem, setToDoItem] = useState({title: '', body: ''})\n\n    function addNewToDo(e) {\n        e.preventDefault()\n    \n        const newToDo = {\n            ...toDoItem, id: Date.now()\n        }\n        create(newToDo)\n        setToDoItem({title: '', body: ''})\n        localStorage.setItem('tasks', JSON.stringify(toDoItem))\n    }\n\n    return (\n        <form className={cl.myForm}>\n            <h1 className={cl.headerAdd}>New to-do</h1>\n            <MyInput\n                value={toDoItem.title}\n                onChange={e => setToDoItem({...toDoItem, title: e.target.value})}\n                type=\"text\"\n                placeholder='This is title...'\n            />\n            <MyInput\n                value={toDoItem.body}\n                onChange={e => setToDoItem({...toDoItem, body: e.target.value})}\n                type=\"text\"\n                placeholder='This is description...'\n            />\n            <MyButtonAdd onClick={addNewToDo}></MyButtonAdd>\n        </form>\n    )\n}\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,OAAO,MAAM,kBAAkB;AACtC,OAAOC,WAAW,MAAM,qCAAqC;AAC7D,OAAOC,EAAE,MAAM,uBAAuB;AAAA;AAEtC,eAAe,SAASC,QAAQ,OAAW;EAAA;EAAA,IAAV;IAACC;EAAM,CAAC;EACrC,MAAM,CAACC,QAAQ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